package com.example.edu.Mapper;

import com.example.edu.Entity.Picture;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PictureMapper {
    @Select("select picture_id from picture where `key` = #{md5}")
    Integer getPictureId(@Param("md5") String md5);

    @Insert("insert into picture(`key`, type) values (#{picture.key},#{picture.type})")
    @Options(useGeneratedKeys = true, keyProperty = "picture_id")
    void addPicture(@Param("picture") Picture pictureMessage);

    @Select("select p.picture_id,p.`key`,p.type from picture p left join picture_doc pd on p.picture_id = pd.picture_id " +
            "where pd.document_id is null")
    List<Picture> getWildPicture();

    void deleteByKeys(@Param("keys") List<String> keys);
}
